/**
 * Copyright (c) 2009 Teoti Graphix, LLC See:
 *     http://tkarchitecture.teotigraphix.org
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 * @author Michael Schmalle mschmalle@teotigraphix.com
 */
package org.teotigraphix.dx.core
{

import mx.core.IUIComponent;

//[ExcludeClass]

/**
 * A static enumeration class for used constants in the tkarchitecture.
 * 
 * @copyright Teoti Graphix, LLC
 * @author Michael Schmalle
 * @date 05-24-08
 * 
 * @private
 */
public final class ToolKitConstants
{
	include "Version.as"
	
	//--------------------------------------------------------------------------
	//
	//  Public Class :: Properties
	//
	//--------------------------------------------------------------------------
	
	/**
	 * @private
	 */
	public static const toolKitPropertyMap:Array =
	[
		CORE_SKIN,
		CORE_BEHAVIOR,
		CORE_MODEL,
		BEHAVIOR_LAYER,
		BEHAVIORS,
		SKIN_LAYER,
		MODEL_LAYER,
		MODELS,
		TOOL_KIT_FACTORY
	];
	
	/**
	 * @private
	 */
	public static function isValidToolKitProperty(name:String):Boolean
	{
		switch (name)
		{
			case CORE_MODEL:
			case CORE_SKIN:
			case CORE_BEHAVIOR:
			
			case MODEL_LAYER:
			case SKIN_LAYER:
			case BEHAVIOR_LAYER:
			
			case MODELS:
			case SKINS:
			case BEHAVIORS:
			
			case TOOL_KIT_FACTORY:
				return true;
		}
		return false;
	}
	
	// core
	public static const CORE_SKIN:String = "coreSkin";
	public static const CORE_BEHAVIOR:String = "coreBehavior";
	public static const CORE_MODEL:String = "coreModel";
	
	// layer
	public static const MODEL_LAYER:String = "modelLayer";
	public static const SKIN_LAYER:String = "skinLayer";
	public static const BEHAVIOR_LAYER:String = "behaviorLayer";
	
	// collections
	public static const MODELS:String = "models";
	public static const SKINS:String = "skins";
	public static const BEHAVIORS:String = "behaviors";
	
	// factory
	public static const TOOL_KIT_FACTORY:String = "toolKitFactory";
	
	//--------------------------------------------------------------------------
	//
	//  Public Class Style :: Properties
	//
	//--------------------------------------------------------------------------
	
	public static const STYLE_NAME:String = "styleName";
	
	public static const VERTICAL_ALIGN:String = "verticalAlign";
	public static const HORIZONTAL_ALIGN:String = "margin";
	
	public static const BUTTON_WIDTH:String = "buttonWidth";
	public static const BUTTON_HEIGHT:String = "buttonHeight";	
	
	public static const EMBEDDED_BORDER_METRICS:String = "embeddedBorderMetrics";
	
	public static const MARGIN:String = "margin";
	public static const MARGIN_TOP:String = "marginTop";
	public static const MARGIN_RIGHT:String = "marginRight";
	public static const MARGIN_BOTTOM:String = "marginBottom";
	public static const MARGIN_LEFT:String = "marginLeft";
	
	public static const PADDING:String = "padding";
	public static const PADDING_TOP:String = "paddingTop";
	public static const PADDING_RIGHT:String = "paddingRight";
	public static const PADDING_BOTTOM:String = "paddingBottom";
	public static const PADDING_LEFT:String = "paddingLeft";
	
	public static const BACKGROUND_ALPHA:String = "backgroundAlpha";
	public static const BACKGROUND_COLOR:String = "backgroundColor";
	public static const BACKGROUND_DISABLED_COLOR:String = "backgroundDisabledColor";
	public static const BACKGROUND_IMAGE:String = "backgroundImage";
	public static const BACKGROUND_SIZE:String = "backgroundSize";
	public static const BORDER_COLOR:String = "borderColor";
	public static const BORDER_SIDES:String = "borderSides";
	public static const BORDER_SKIN:String = "borderSkin";
	public static const BORDER_STYLE:String = "borderStyle";
	public static const BORDER_THICKNESS:String = "borderThickness";
	public static const CORNER_RADIUS:String = "cornerRadius";
	public static const DROP_SHADOW_ENABLED:String = "dropShadowEnabled";
	public static const DROP_SHADOW_COLOR:String = "dropShadowColor";
	public static const SHADOW_DIRECTION:String = "shadowDirection";
	public static const SHADOW_DISTANCE:String = "shadowDistance";
	
	public static const TITLE_STYLE_NAME:String = "titleStyleName";
	public static const TITLE_BAR_STYLE_NAME:String = "titleBarStyleName";
	
	public static const RESIZE_HIT_TEST_THICKNESS:String = "resizeHitTestThickness";
	
	public static const BOUNDS_OFFSET:String = "boundsOffset";
	
	public static const OPEN_DURATION:String = "openDuration";
	public static const CLOSE_DURATION:String = "closeDuration";
	public static const OPEN_EASING_FUNCTION:String = "openEasingFunction";
	public static const CLOSE_EASING_FUNCTION:String = "closeEasingFunction";
	
	/**
	 * Includes or excludes a composite child in the container's layout.
	 * 
	 * <p>This method allows developers to override the default 
	 * functionality.</p>
	 * 
	 * @param instanceOrArray A IUIComponent that will be included or excluded from
	 *		the layout or an Array that will be used to loop through
	 *		as set of IUIComponents.
	 * @param visible A boolean indicating whether to show or hide the composite
	 *				instance(s).
	 */
	public static function setIncludeInLayout(parent:Object,
											  instanceOrArray:Object, 
											  visible:Boolean):void
	{
		if (instanceOrArray is IUIComponent)
		{
			instanceOrArray.visible = visible;
			instanceOrArray.includeInLayout = visible;

		}
		else if(instanceOrArray is Array)
		{
			for each(var child:IUIComponent in instanceOrArray)
			{
				child.visible = visible;
				child.includeInLayout = visible;
			}
		}

		parent.callLater(parent.invalidateViewMetrics);
	}
}
}